﻿using Autofac;

using Autofac.Core;
using Autofac.Extensions.DependencyInjection;
using BingYing.SAAS.SystemModel.Application;
using BingYing.SAAS.SystemModel.EntityFramework;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Qianke.Core.Common;
using Qianke.Core.Saas.WebApi;
using System.Diagnostics;
using System.Text;
using Volo.Abp;
using Volo.Abp.AspNetCore;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Autofac;
using Volo.Abp.Castle;
using Volo.Abp.Modularity;

namespace BingYing.SAAS.SystemModel.WebApi
{
    [DependsOn(
        typeof(AbpAutofacModule),
        typeof(AbpAspNetCoreMvcModule),
        typeof(SystemModelApplicatonModule),
        typeof(QiankeCoreSaasWebApiModule)
        )]
    public class SystemModelWebApiModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var services = context.Services;
            //动态Api
            Configure<AbpAspNetCoreMvcOptions>(options =>
            {
                options.ConventionalControllers.Create(typeof(SystemModelApplicatonModule).Assembly,
                    options => {
                        options.RemoteServiceName = "default";
                        options.RootPath = "V1";
                        options.UseV3UrlStyle = true;
                    });
            });

            var data = new { bResult = false, Id = 1 };
            var str = data.ToJson();
            Trace.WriteLine(str);
        }

        public override void OnApplicationInitialization(ApplicationInitializationContext context)
        {
            var app = context.GetApplicationBuilder();

            base.OnApplicationInitialization(context);
        }
    }
}
